Repository navigation
fix: sweep round 6: every suggested command runs, @file for code and secrets, function check exit 6, environment export, add-playbook - #60
Open
Bradenream wants to merge 32 commits into
Conversation
Round 5 taught @file to --prompt, --instructions and --content only, so `function create --code @lookup_order.js` saved the words "@lookup_order.js" as the function's code, exit 0, and the function only failed later, in a conversation. `secret set-value --value -` stored a dash, and `--value @secret.txt` the path, and neither help said so. Found by the round-5 sweep's agent-builder, agent-migrator and agent-ci testers. --code (function create and update), the patch commands' --old-string and --new-string (function patch-code, agent patch-prompt and patch-instructions, playbook patch-instructions), a prompt's --system and function check's --cases now take @file for a file's text and - for stdin's, and --body takes @file as it took -. Their help says so, ahead of [required]. A secret's --value and --default-value read them too, which keeps the value off the command line, where ps and a shell's history see it. The line break that ends a file or `echo`'s output is dropped, and an empty value is refused. No error repeats the value: a --value @hunter2 that names no file says "invalid value for --value" without it, and a --body that isn't valid JSON on a command holding a secret no longer prints "You passed: ...".
`function check` printed its cases and exited 0 whatever they were. The
round-5 sweep's agent-builder tester gave a case an expectOutputs it
didn't meet and got `matched: false`, "0 failed; 2 of 3 matched what you
expected." and EXIT=0, so a CI step or a coding agent that gates on the
exit code passed a broken function. The API's "0 failed" counts only the
cases that threw.
Once the result is printed, a case that didn't run, threw, or didn't
match its expectPath or expectOutputs now makes check exit 6, as `test
run wait` does, with a line that names each such case and why:
Error: 1 of 3 cases didn't pass
- "deliberately wrong" didn't match what you expected: order_status
was "processing", expected "shipped"
A check that refused to run (checked: false) exits 6 with its reason,
since nothing was verified. In agent mode and with -o json the error is
the usual JSON, error_type function_check_failed. When every case passed,
a person at a terminal gets a ✓ line. `vf --help` and the README list
function check under exit code 6.
…e last
pflag keeps the last value of a flag that takes one and drops the rest
without a word. The round-5 sweep's human-kb tester ran `document
create-text --file faq/refunds.md --file faq/accounts.md --wait` at the
home prompt and got "✓ Added accounts.md"; refunds.md was never added,
and only a later `document list` showed it. The same silence picks the
wrong project for `-p A … -p B` or the wrong environment for `-e main …
-e staging`.
Before anything is asked or sent, vf and the home prompt now refuse such
a flag with exit 2, naming it and both values:
Error: --file was given twice, as faq/refunds.md and as faq/accounts.md
- --file takes one value, and vf would have used only the last.
Nothing was sent.
Next:
'vf document create-text' takes one file: run it once for each file
This holds for every flag that takes one value, not only --file: none can
use two, and which one wins shouldn't depend on the order of words. The
same value twice still runs, as do flags that collect values (--header,
list flags such as --run-ids). A secret's values, and a --body that may
hold one, are not repeated. Forms and pickers set flags after the check
and are unaffected.
A knowledge base document's options (--overwrite, --single-chunk, --markdown-conversion and the --llm-* flags, 39 flags on six document commands) are a union of a boolean and the strings "true" and "false" in the spec, so they are string flags. Given bare, as the switch --wait next to them is, `--overwrite --dry-run` took "--dry-run" as the value and failed with "it isn't valid JSON at character 2", and a bare --overwrite last on the line said only that it needed a value. Found by the round-5 sweep's agent-ci, agent-migrator and agent-builder testers. pflag's NoOptDefVal alone would turn the `--overwrite true` that help and hints write into the flag plus a stray word "true". So these flags are marked where their metadata is described, and vf and the home prompt rewrite one given bare, with nothing or another flag after it, as --overwrite=true before cobra or any other check reads the line. `--overwrite true`, `--overwrite false` and `--overwrite=false` work as before, and so does -s for --single-chunk. A value that is neither now says "invalid value for --overwrite: it takes true or false", not that it isn't valid JSON.
`vf agent update --instructions @instructions.md`, run before the
variables it names existed, kept {customer_name} and {tier} as literal
text and exited 0. The answer said "Kept as literal text" and listed
unresolvedReferences, but a script under set -e carried on with a prompt
that would never fill in, and the round-5 agent-migrator tester had to
parse the list by hand.
A non-zero exit by default would be wrong: the change is saved by then,
and a script that reads a failed exit as "nothing happened" retries, so a
create runs twice. So it is a flag. --strict, on the 34 commands whose
answer can list unresolvedReferences (agent update and patch-*, playbook,
prompt, message, tool, api-tool, mcp-server and workflow writes), prints
the answer as before, then exits 1 with error type unresolved_references
and a line per {token}: where it was, why it didn't bind, and that the
change was saved. A backticked mention that matched no attached tool
(unresolvedMentions) fails it too. Without --strict nothing changes.
The commands are listed in cli/strict.go; a test reads each command's SDK
call and fails when the list and the SDK disagree.
… differences." The API's environment diff counts resources but leaves out the agent's global prompt, so after `agent patch-prompt` or `agent update --prompt` it still answers three zero counts and an empty list. Since 972814f, pretty output then ended with "No differences.", and testers read it as "nothing to publish" while the published version kept running the old prompt. Nothing the SDK calls can read the published version's prompt (read-prompt reads the draft; releases are backups with no read), so vf can't compare it either. Pretty output now says "No differences in the environment's resources (workflows, playbooks, tools, variables, the agent's instructions and the like)" when the counts are zero, and always "Not compared: the agent's global prompt", with how to ship an edit. JSON, YAML, TOON, --jq and agent mode get the API's answer with a new notCompared key saying the same; the API's own fields are byte-for-byte as sent. diff --help says what it compares. nodiff.go becomes diffcoverage.go. Round-5 sweep R5 #2 (agent-ci:F1, fix-verifier:N1).
…s the final status
`document update --wait` printed the API's message as a ✓ line ("…It is
being processed again, so `vf document get` shows status PENDING until it
is searchable"), then "✓ Updated refunds.md (d1) · ready". Two ✓ lines
contradicted each other. Agent mode and -o json got only the message,
stale by then, with no status to check: the only sign of success was
exit 0.
With --wait, a person at a terminal now sees only how the wait ended.
JSON, YAML, TOON, --jq and agent mode get the API's message with a new
status key beside it, holding the status the wait ended on, as a create's
--wait answer carries it; -o json keeps the API's bytes and adds the key
last. A wait that couldn't read the status leaves the answer as it came.
Round-5 sweep R5 #27 (fix-verifier:N4, human-kb:F4).
…ine per frame
A spinner redraws its frame with \r, which returns only to the start of
the current line. A frame wider than the terminal wraps, so each redraw
left the wrapped part behind. The document wait's frame ("Processing
document 6b0e…… 0s · ctrl-c stops waiting, not the processing") is 85 to
97 columns, and at 80 columns a 2-second wait left about 20 lines.
Every spinner's frame now fits the terminal's width, measured each frame
so a resize is followed: the hint goes first, then the message is cut,
ending in "…". The last column stays empty, since a line that reaches it
wraps on some terminals. Off a terminal nothing changes. Round-5 sweep
R5 #38 (human-kb:F9).
…ill processing" is explained
A URL whose site answered HTTP 429 ends status ERROR with
{"code": "urlRateLimited", "message": "The website is limiting how often
pages are fetched (HTTP 429)."}. `create-url --wait` printed "✗ Couldn't
process …" and "Fix the source, then add it again with --overwrite true",
but nobody can fix Wikipedia. The retry, right away, got 409 "document is
still processing, please retry after it finishes" with only "It conflicts
with the current state", while the list said ERROR; later the document
went INITIALIZED with nobody touching it. The knowledge base was still
trying, and a newcomer had no next move.
A wait that ends rate-limited now says "The site refused <doc> for now
(rate-limited): try again in a few minutes", as a ⚠ warning rather than a
final ✗, with the API's reason, that the knowledge base may still be
trying, and what to do if it still says ERROR later. It still exits 1;
JSON and agent mode get error_type document_rate_limited. A create
without --wait that comes back rate-limited says the same. The 409 "still
processing" now says the knowledge base is still working on the document
and takes no new version until done, that its status can read ERROR
meanwhile, and to wait a few minutes. Round-5 sweep R5 #13
(human-newcomer:F3).
… add documents Adding a document lives under `vf document`, but `knowledge-base --help` listed only `query`, and the home prompt's menu matched command names alone: "/upload" gave an empty menu and "/add" only agent, workflow and message commands. A newcomer spent four calls and guesses on "add my FAQ to the knowledge base" before the full `vf help` turned up `document`. `knowledge-base --help` now says documents are added with vf document, with create-text, create-url, create-table and list. In the menu, "upload", "add", "kb" and "faq" (and "website", "spreadsheet") also find the commands that add documents, after the commands the word names. A word that names no command finds the commands whose summary has a word starting with it, before the abbreviation search; summaries are only a fallback, so "pro" still finds just `project`. Round-5 sweep R5 #14 (human-newcomer:F4).
…less told otherwise What was wrong: `conversation send` and `knowledge-base query` required --version-param, with no default and no word on what draft or published means, while `conversation run-script` already defaulted to draft. Left out, vf opened a draft/published picker on every turn, or failed with "missing required flag" without a terminal. The query's one example passed published, so people searched the knowledge base their live agent sees, not the one they had just added documents to. And --synthesis didn't show its default, so agents passed --synthesis=false "to be safe", not knowing whether a model call (and its credits) was on. (Round-5 sweep R5 #21 and #33: human-newcomer F6, human-kb F5, agent-builder F12, agent-migrator F6.) What changed: both commands default --version-param to draft, and its help says what each version is: draft, the latest edits (compiled first when a conversation starts; that still happens with the default), and published, what live users get since the last `vf environment publish`. --synthesis shows "(default true)", says it uses credits and reports its tokens, and that --synthesis=false makes no model call; left unset it is still not sent. The examples lead with the default and show published once. The hooks are one line in each generated file; the rest is in conversation/version.go and knowledgebase/version.go. Tests: TestSendAndQueryTalkToTheDraftByDefault, TestVersionHelpSaysWhatEachVersionIs.
…r create says how to fill it What was wrong: no list showed which documents were in a folder. A document carries only its folder's 24-character ID, so `document list -o table` had a FOLDER ID column of hex (the first column left out at 80 and 100 columns), `document folder list` shows no documents, and testers matched folderID values by eye in the YAML. And after `document folder create` the only Next line was "list them": nothing said that `document update --folder-id` moves a document in. (Round-5 sweep R5 #6: human-kb F2, F3.) What changed: `document list -o table` reads the folder list once, only when a document is in a folder, and shows a FOLDER column with the folder's name, or its path when nested (FAQ/Billing). A folder the list doesn't have, or a folder list vf can't read, shows the ID as before. JSON, YAML, TOON, --jq, pretty output and agent mode print the API's answer as it came and read no folders. `document folder create` now ends with "vf document update --document-id <document id> --folder-id <new id> move a document into it" and "vf document list -o table each document's ID, and the folder it's in", ahead of "list them". A create command names its own next steps through a command annotation (output/ownsteps.go); created.go has a one-line hook for it. Not done: --folder-id on `document list`. The API's document list filters only by sitemap, not by folder. Tests: TestTheDocumentTableNamesEachFolder, TestAFolderCreateSaysHowToFillIt, TestAFolderedDocumentKeepsEveryField, TestAFolderIsNamedByItsPath, TestACreateNamesItsOwnNextSteps; TestOutputTableShowsADocumentsNameTypeAndStatus updated for the FOLDER header.
…hole The wrapper kept a command whole only while it fitted the room left on the line. A longer one broke between its words, and vf wrote the break itself: "Pass it: vf conversation send --environment-alias main --project-id" / " 6b0e… --user-id u1 --version-param draft --text <value>". A copy of the missing-flag hint, the commonest one, pasted two lines, and the shell ran the first half alone, with no --user-id and no --text. Now a command is one unbreakable word to the wrapper however long it is: it moves to a line of its own after "Pass it:" and runs past the edge, where the terminal's soft wrap shows it and a copy takes it whole. That holds for a command in the accent color, a quoted one, and, with NO_COLOR, "vf" and its flags typed into a sentence (ui/commandspan.go finds where such a command ends). Found by the round-5 sweep's fix-verifier (N2) and human-poweruser (F10).
…words 240288c wrapped help, warnings and replies, but text vf printed elsewhere still ran past the terminal's edge and broke mid-word. At a terminal each now goes through the shared wrapper (ui/wrap.go), so prose breaks at its words and a command or a URL stays whole: - A hint that is a command and then prose ("vf document list --project-id 6b0e… --environment-alias main shows what's there") counted as a command, so it was left whole and broke at `--environment` / `-alias`. A command now ends where the prose starts (ui/commandspan.go). - The description above a form ("Word (" / ".docx)") and a field's description, which lipgloss broke at a hyphen ("· --" / "version-param"), in interactive/formwrap.go. - The home prompt's "Nothing is current yet … or use project" and its "is now your current project" note. - test run get's check reasons ("no disc" / "repancy"), its turns, and its summary line. - Pretty output's values and blocks: a chunk's text, a diff, a long description (output/prettywrap.go), under the value or at the block's indent. An ID or a URL too long for the room has a line of its own. - docs get's page; its code blocks and tables stay as written. Pipes, -o json and agent mode are unchanged. Found by the round-5 sweep's fix-verifier (N3), human-poweruser (F10), human-kb (F9) and human-newcomer (F10, F11).
Help wrapping continued each row under the description its own gap pointed to, and at 72 columns two kinds of row lost their column. A command whose name fills the padding has a one-space gap, so `secret --help`'s list-overrides summary continued at the row's indent as "version", which read as a command. And `evaluation create --help`'s longest flag is 45 columns, which left its descriptions under 24, so they fell back to the flags' indent and ran under the flags. Now a section's description column is the one its rows share, and every row continues there (helpcolumns.go). When that column leaves a description less than two-fifths of the width, the section moves it left to two-fifths, and a flag too long for it has its description on the line below. Every command's help is checked at 60, 72 and 100 columns. Found by the round-5 sweep's human-poweruser (F5, F6).
… a row is A table too wide for the terminal left out its last columns in the API's order and cut the widest. At 72 columns event list dropped GOES TO and REQUEST NAME but kept CREATED AT, test run search dropped PASSED CHECKS, document list kept a mostly empty TITLE over FOLDER ID, and a secret's NAME was cut mid-word (SALESFORCE_OAUTH_CLIEN...). Now times go first, then mostly empty columns, true/false columns, other things' IDs and long text, then the rest. The row's ID and its name stay whole; the name is cut only when the two alone don't fit. The note still names what was left out. Pipes, -o json and agent mode are unchanged.
A JSON flag showed its shape only when the spec gave it no description. --playbooks and --workflows on agent update said what the list is for and that it replaces the stored one, but not what an item holds; only the error on a wrong value gave [{ ..., playbookID: string }]. 54 flags were like that.
Now the spec's words come first, then 'JSON: <shape>', the same shape the error gives. Their words still name vf commands; the shape's keys are left as typed.
Help said only that --code is the JavaScript run when the function runs, with the example --code <value>. What the code exports, where its inputs arrive and how it returns outputs and picks a path were in the docs alone: one tester spent three calls finding them, and code written from a guess fails only when it runs. Both commands' help now shows the smallest function that works (export default async function main(args), args.inputVars, outputVars, next.path), the commands that declare its variables and paths, and the docs page with the whole contract.
The default output gave each document about fifteen lines of YAML (data, folderID, id, smartChunking, then status under its own key). Six documents folded behind '... +68 lines', and finding which were ready meant scrolling past chunking settings. -o table showed them on six lines, for whoever knew to ask. At a terminal document list now prints its table: ID, name, type, status and folder, fitted to the width. An empty list, a pipe, -o yaml/json and agent mode print what they did.
widget get-snippet pins the widget to the environment's published version. A new project's only release is "First version", made with the project, so a newcomer who edited the agent and never published got a snippet for the empty template agent, and nothing said so. The snippet also printed under `snippet: |`, which came along when it was copied. Now a person gets the snippet bare, then where to paste it. After the snippet vf reads the environment and warns when nothing has been published since it was made, with `Next: vf environment publish …`. When a later release exists, the environment's diff says whether the draft has changes the release lacks. JSON, YAML, TOON, --jq and agent mode print the snippet as before, with the warning on stderr (a JSON event with the hint in agent mode). A draft snippet, a dry run or a failed read checks nothing. Found by the round-5 sweep's human-newcomer.
… agent playbook create made a playbook the agent couldn't reach: the agent hands off only to the playbooks in its own list, and nothing said so. add-workflow and remove-workflow exist for workflows, but the only way to route a playbook was agent update --playbooks with the whole list, which replaces it. The API has no endpoint for one playbook, so vf agent add-playbook and remove-playbook read the agent's playbooks, add or drop that entry and send the list back in one agent update. Every other entry goes back as read (description, condition, required variables) and nothing else on the agent is sent; help says so. An entry vf can't read stops the command before it writes. add-playbook's --description defaults to the playbook's own. Adding one already routed exits 1, removing one not routed exits 4, and a dry run shows the read and what the write would send. playbook create now ends with a warning that the playbook isn't routed yet, and `Next: vf agent add-playbook …` (a JSON event in agent mode). agent update --playbooks gives the list's JSON shape. Found by the round-5 sweep's agent-builder.
`transcript get --format-param logs` failed in pretty, YAML, table and agent output with "couldn't read the response ... update vf", while -o json worked. The spec gives each log's createdAt and updatedAt as a date; the API sends a date and time, so the SDK's typed decode fails, and every format but -o json decodes first. A typed fix would lose the time of day, and the next field the spec gets wrong would fail the same way. So the client now keeps the body of each successful GET that answers JSON until the next request starts (client/keepanswer.go), and when the SDK can't decode it, Error prints that body as the result in the format asked for and the command succeeds, as -o json would have (output/undecoded.go). Only reads: a write's command may have more to do with its answer, so a write still fails as before. The fixture is round 5's logs transcript.
A migrator had no way to take a project out of Voiceflow with vf. The API
has an export endpoint, GET /v2/stable/environment/{alias}/export, but the
spec marks it x-speakeasy-ignore, so the SDK has no method for it and no
command was generated.
sdk/environmentexport.go adds Environment.Export, written as Speakeasy
writes Environment.Get: same server URL, credential, hooks and HTTP client,
so --dry-run, --debug, --timeout, -H and a missing token behave as for any
other call, and an error status is the usual SDK error (a 404 exits 4). The
answer is left unread.
`vf environment export -p <id> -e <alias> [--file path]` prints the export
as JSON, indented, in agent mode too, or writes it to --file once the whole
answer has arrived, replacing the file, and says where and how big. -o and
--jq apply when given. A dry run writes nothing.
…num's values
`conversation send -p … --text hello --no-interactive` was told to run
`vf conversation send --action "{\"payload\":\"hello\",…}" --project-id …
--text hello …`, and vf refuses that line: "--text and --action both say
what to send". The hint was built from every flag set by the time the
request was built, and send had set --action itself from --text.
`document create-table --csv` sets --items and --schema the same way.
Each command now notes the flags its line set as it starts, before its own
code sets any (typedflags.go), and the "Pass them:" line repeats only
those. A flag left out shows the values it takes where its help lists them,
`--version-param <draft|published>` rather than `<value>`, and a
true/false one is written `--flag=<true|false>`, since `--flag false`
leaves "false" a stray word.
The command offered for a stray word was a piece of the line. `vf transcript get <id> -p X` offered `vf transcript get --transcript-id <id>` without -p, which failed again for want of --project-id. `conversation send --text Hello there`, unquoted, sends "Hello" and leaves "there", and the hint offered `--text 'there'`, the message without its first word. Both hints are now the whole command line, built as the missing-flag hint is, from the flags typed: `vf transcript get --project-id X --transcript-id <id>`, and `vf conversation send … --text 'Hello there'`. Words that come with --text are the rest of its message, and the line leaves out the --action that --text stands for, which vf refuses beside it.
…line `vf transcrpit search -p X` was asked "Did you mean `vf transcript`?" and `vf secret ls -p X` "Did you mean `vf secret list`?". Run as written, the first printed the group's help and the second asked for a project: the rest of the line was gone. A misspelt flag got only the flag, `--name`, to fit back into the line by hand. And a flag given no value was told "Give it one: `--version-param <value>`", without the values it takes. The suggestion is now the line vf was run with, the misspelt word replaced, with the command's own flags as the missing-flag hint writes them (typofix.go): `vf transcript search --project-id X`, `vf workspace create --name "two words"`. The line is parsed into copies of the command's flags, so the real ones are left as they were. Where the fixed flag takes only some values and the one typed isn't among them (`tool get -t <id>` as --type), and in the home prompt, whose lines aren't vf's arguments, the hint names the command or flag alone, as before. A flag given no value shows its choices: `--version-param <draft|published>`.
…ires After `tool create`, Next offered `vf tool get --tool-id … --project-id … --environment-alias main`, and run as written it failed: "vf tool get needs --type". The Next lines gave the new thing's ID and the scope flags the create was given, and nothing else the get or list requires, though the type was right there in what the create answered. A nested thing's get or list needs its parent the same way (`function variable get` needs --function-id). Each Next line now adds every other flag its command requires, its value taken from the create's answer: --type from "type", --function-id from "functionID" (nextneeds.go). A value the answer doesn't have is <value>.
…the next turn will After an edit mid-conversation, a turn that ran the older build warned "vf has compiled it, so the next turn runs your latest edits". In the usability sweep the next turn still answered without the edit twice, and only a new --user-id took it. Whether the conversation kept the old build or the model kept to its earlier replies, vf can't tell, so the promise was one it couldn't keep. The warning now says what vf knows, that it has compiled the draft, and how to be sure a conversation runs the edits: start a new one, with a new --user-id, or reset this user's with `vf conversation state delete --user-id … --project-id … --environment-alias … --version-param draft`, given in full. send's help and the README say the same. When vf compiles is unchanged.
The test that runs every command vf suggests (a later commit) found two kinds of missing-flag hint that failed as written: - The list that shows an ID's values dropped the flags typed, and what it needs itself. `vf tool get -e staging` pointed at `vf tool list`, which lists main's tools; `vf api-tool variable update` at `vf variable list`, the agent's variables; `vf project get` at `vf project list`, which needs --workspace-id. The list now keeps the IDs and aliases typed that it takes, gives a placeholder for each flag it requires that the command was run without or doesn't have, and is the one in the command's own group when the group is the flag's noun. - "Pass them" left out a body that must be one of its forms. `vf tool create -e main` was handed a line without --body-param, which then failed with "the body is none of its forms". The line now gives the first form, as help's examples do. When the body is all that's left out, that error offers the line with a form too, where it said only that --help lists the forms.
…equires The tests that run every command vf suggests (a later commit) found lines that the command they name refused: - `vf workspace create` offered `vf project create --workspace-id … --name <name>`, without the --type project create requires. - `vf phone-number create` offered `vf phone-number get --phone-number-id …` without --workspace-id. The create takes it in its body, so withScope had no flag to carry; it now comes from the answer. A parent ID the answer lacks comes from the create's flags. - The list a 404 points at left out what it requires: `vf function path list` the --function-id, `vf test turn list` the --test-id, `vf project list` the --workspace-id. withScope now adds each flag the command requires that the line doesn't give, with the value typed, or else <value>.
The usability sweep found suggested commands failing one at a time: a "Pass them:" line with --action beside --text, which vf refuses; an ID hint that dropped the -p typed; "Did you mean `vf transcript`?" for a line with more on it; a tool get Next line without its --type. Each was fixed where it was found. TestEverySuggestedCommandRuns makes every command make the usual mistakes against a fake API on 127.0.0.1: required flags left out, stray words, an ID or a message given as words, a misspelt command, group or flag, and an ID the API doesn't know. It gathers each `vf …` the explanation offers, 2814 of them (1000 different), and holds each to cmdcheck.Check: the command exists and isn't a group, every flag exists and takes its value, no two flags vf refuses together, no stray word, the flags typed are kept, and nothing the command requires is left out. A mistake vf knows the fix for must get a whole line, not a piece. TestEveryNextLineRuns does the same for the 50 Next lines a create, clone or duplicate prints. On d4d386d, before this branch, they report 3274 and 9 problems, among them each of the sweep's: --text with --action, the dropped -p, the unquoted message and misspelt flag given as pieces, the bare group, and tool get without --type. They also found what the two commits before this fixed.
There was a problem hiding this comment.
🟡 Changes recommended
Command hints can expose secrets and generate unsafe retries that, when pasted, execute shell substitutions or perform writes after dropping dry-run safeguards.
7 open issues
Use shell-safe quoting for retry arguments · New Redact secret bodies in positional-ID hints · New Redact secret-bearing bodies in typo hints · New Keep wait results when stdout is redirected · New Retain dry-run in positional-ID retry hints · New Preserve dry-run and server flags in typo hints · New Preserve wait failure verdict in SDK-error fallback · New
9 files not reviewed
internal/cli/agent/patchinstructions.go: Generated fileinternal/cli/agent/patchprompt.go: Generated fileinternal/cli/agent/root.go: Generated fileinternal/cli/conversation/send.go: Generated fileinternal/cli/document/documentfolder/create.go: Generated fileinternal/cli/document/list.go: Generated fileinternal/cli/document/update.go: Generated fileinternal/cli/environment/diff.go: Generated fileinternal/cli/environment/root.go: Generated file
What changed in this PR
This PR improves the Voiceflow CLI’s reliability for interactive users and scripts, focusing on runnable command suggestions, safer input handling, meaningful exit codes, and clearer terminal output.
Changes:
- Reconstructs command hints with relevant flags and adds validation for suggested commands.
- Expands file/stdin input, adds strict reference checking and function-check failure exits, and improves document status reporting.
- Adds environment export and playbook-routing entry points while improving help, discovery, and terminal layout.
| File | Description |
|---|---|
test/errors-teach.test.ts |
Expects required scope flags in error hints. |
README.md |
Documents compile guidance, exit 6, and strict writes. |
internal/ui/wrap.go |
Keeps commands intact while wrapping surrounding prose. |
internal/ui/wrap_test.go |
Tests long commands and adjacent prose. |
internal/ui/spinner.go |
Fits spinner frames to terminal width. |
internal/ui/spinner_test.go |
Tests spinner truncation and hint removal. |
internal/ui/commandspan.go |
Identifies command spans for wrapping. |
internal/prompt/intents.go |
Adds task-based command discovery. |
internal/prompt/intents_test.go |
Tests intent and description matching. |
internal/prompt/complete.go |
Integrates intent-based completion. |
internal/output/undecoded.go |
Prints successful reads despite SDK decoding failures. |
internal/output/tableview.go |
Uses prioritized table-column fitting. |
internal/output/strict.go |
Fails strict writes with unresolved references. |
internal/output/prettywrap.go |
Wraps pretty values at terminal width. |
internal/output/prettywrap_test.go |
Tests value wrapping and unchanged piped output. |
internal/output/ownsteps.go |
Supports command-specific next steps. |
internal/output/ownsteps_test.go |
Tests custom next-step ordering and scope. |
internal/output/output.go |
Integrates strict verdicts and new output paths. |
internal/output/nextrun_test.go |
Validates create-command next steps. |
internal/output/nextneeds.go |
Adds required flags to suggested commands. |
internal/output/listtable.go |
Shows document lists as tables at terminals. |
internal/output/listtable_test.go |
Tests terminal tables and pipe preservation. |
internal/output/hintfit.go |
Completes required flags in scoped hints. |
internal/output/hintfit_test.go |
Tests complete, correctly scoped next steps. |
internal/output/export_test.go |
Exposes next-step commands to external tests. |
internal/output/exitcode.go |
Maps failed function checks to exit 6. |
internal/output/doctype.go |
Explains documents that are still processing. |
internal/output/doctype_test.go |
Tests processing-conflict explanations. |
internal/output/created.go |
Uses create responses to build next steps. |
internal/output/created_test.go |
Adapts next-step tests to response context. |
internal/output/badbody.go |
Offers a complete command with a body form. |
internal/interactive/interactive.go |
Wraps form headers and descriptions. |
internal/interactive/formwrap.go |
Adds word-aware form-text wrapping. |
internal/interactive/formwrap_test.go |
Tests readable headers and intact flag names. |
internal/flagutil/truefalse.go |
Marks boolean-like flags supporting bare use. |
internal/flagutil/stdin.go |
Adds --body @file input. |
internal/flagutil/inputerror.go |
Clarifies boolean-like flag errors. |
internal/flagutil/forms.go |
Registers boolean-like flag annotations. |
internal/flagutil/description.go |
Appends JSON shapes to described flags. |
internal/client/keepanswer.go |
Retains successful GET bodies for fallback output. |
internal/client/client.go |
Installs response retention in the client. |
internal/cli/wrapresidue_test.go |
Tests home text and documentation wrapping. |
internal/cli/widget/getsnippet.go |
Routes snippets through presentation and freshness checks. |
internal/cli/undecoded_test.go |
Tests read fallback across output formats. |
internal/cli/typofix.go |
Reconstructs full typo-correction commands. |
internal/cli/typofix_test.go |
Tests corrected command lines and flag choices. |
internal/cli/typedflags.go |
Distinguishes typed flags from derived flags. |
internal/cli/truefalse.go |
Normalizes bare boolean-like flags to true. |
internal/cli/testdata/transcript-logs.json |
Adds transcript logs with timestamp fields. |
internal/cli/test/run/runview.go |
Wraps test-run explanations and conversation turns. |
internal/cli/test/run/runview_test.go |
Tests test-run layout at narrow widths. |
internal/cli/tableview_test.go |
Updates document folder-column expectations. |
internal/cli/strict.go |
Registers strict mode on applicable writes. |
internal/cli/strayargs.go |
Builds full positional-ID and message corrections. |
internal/cli/strayargs_test.go |
Tests preserved flags and complete messages. |
internal/cli/secret/setvalue.go |
Enables file/stdin secret values. |
internal/cli/secret/create.go |
Enables file/stdin secret defaults. |
internal/cli/root.go |
Wires strict mode and argument safeguards. |
internal/cli/prompt/update.go |
Enables file/stdin system-prompt updates. |
internal/cli/prompt/create.go |
Enables file/stdin system-prompt creation. |
internal/cli/playbook/routehint.go |
Warns that new playbooks need routing. |
internal/cli/playbook/patchinstructions.go |
Enables file/stdin patch text. |
internal/cli/playbook/create.go |
Emits the post-create routing warning. |
internal/cli/outputview_test.go |
Tests environment-diff coverage disclosures. |
internal/cli/missingflags_test.go |
Tests complete missing-flag suggestions. |
internal/cli/knowledgebase/version.go |
Defaults to draft and explains synthesis costs. |
internal/cli/knowledgebase/root.go |
Adds document-discovery guidance to help. |
internal/cli/knowledgebase/query.go |
Applies query defaults and help updates. |
internal/cli/knowledgebase/documents.go |
Points users to document-management commands. |
internal/cli/kbdocuments_test.go |
Tests knowledge-base help and menu discovery. |
internal/cli/home.go |
Applies argument safeguards and wraps context text. |
internal/cli/historysecret.go |
Shares secret-detection helpers with error handling. |
internal/cli/helpwrap.go |
Wraps help by section and column layout. |
internal/cli/helpwrap_test.go |
Allows intact commands beyond terminal width. |
internal/cli/helpcolumns.go |
Preserves readable two-column help layouts. |
internal/cli/helpcolumns_test.go |
Tests command help at multiple widths. |
internal/cli/function/update.go |
Enables code files and function-contract help. |
internal/cli/function/patchcode.go |
Enables file/stdin code-patch text. |
internal/cli/function/create.go |
Enables code files and function-contract help. |
internal/cli/function/codehelp.go |
Documents function inputs, outputs, and paths. |
internal/cli/function/codehelp_test.go |
Tests function-contract help content. |
internal/cli/function/checkexit.go |
Evaluates cases and reports failed checks. |
internal/cli/function/check.go |
Adds case-file input and verdict-based exits. |
internal/cli/folders_test.go |
Tests folder names and folder-filling guidance. |
internal/cli/errors.go |
Integrates full-line hints and secret redaction. |
internal/cli/errors_test.go |
Expects complete resource-discovery commands. |
internal/cli/environment/root.go |
Registers environment export. |
internal/cli/environment/nodiff.go |
Removes the unconditional “No differences” helper. |
internal/cli/environment/diff.go |
Reports what environment comparisons exclude. |
internal/cli/document/update.go |
Prints the response selected after waiting. |
internal/cli/document/ratelimited.go |
Explains temporary website rate limits. |
internal/cli/document/list.go |
Enriches table output with folder names. |
internal/cli/document/foldernames.go |
Resolves folder IDs to readable paths. |
internal/cli/document/foldernames_test.go |
Tests folder paths and preserved document fields. |
internal/cli/document/documentfolder/fill.go |
Defines next steps for filling folders. |
internal/cli/document/documentfolder/create.go |
Registers folder-filling guidance. |
internal/cli/document/docready.go |
Adds final-status output and rate-limit handling. |
internal/cli/document/docready_test.go |
Tests post-wait output and status insertion. |
internal/cli/docs.go |
Wraps documentation prose for terminals. |
internal/cli/docready_test.go |
Tests rate limits and final wait statuses. |
internal/cli/conversation/version.go |
Defaults conversation sends to draft. |
internal/cli/conversation/text.go |
Updates draft and published send examples. |
internal/cli/conversation/send.go |
Applies the draft default during registration. |
internal/cli/conversation/autocompile.go |
Revises stale-turn guidance and adds reset commands. |
internal/cli/bodyhelp.go |
Documents whole-body file input. |
internal/cli/barehelp.go |
Handles text and secret suffixes in help detection. |
internal/cli/barehelp_test.go |
Tests JSON shapes on described flags. |
internal/cli/autocompile_test.go |
Tests revised stale-turn reset guidance. |
internal/cli/agent/root.go |
Registers playbook-routing commands. |
internal/cli/agent/patchprompt.go |
Enables file/stdin prompt-patch text. |
internal/cli/agent/patchinstructions.go |
Enables file/stdin instruction-patch text. |
Review effort: Balanced
Comment on lines
+150
to
+153
| value := f.value | ||
| if value == "" || strings.ContainsAny(value, " \t\"'\\$`") { | ||
| value = strconv.Quote(value) | ||
| } |
| if e.id != "" && len(e.args) == 1 && !e.text { | ||
| // `transcript get 6b0d…` meant the ID. | ||
| x.Next = append(x.Next, "To give it as the ID: `"+e.path+" --"+e.id+" "+shellWord(e.args[0])+"`") | ||
| line := append(typedLine(e.cmd), "--"+e.id, shellWord(e.args[0])) |
| // The global flags typed are left out, as a missing-flag hint | ||
| // leaves them out, but for the one fixed: `--jqq .` is `--jq .`. | ||
| if local.Lookup(f.Name) != nil || fixed { | ||
| line = append(line, givenFlag(f)...) |
Comment on lines
+256
to
+257
| if announces(cmd) { | ||
| return &updatedDocumentResponse{HTTPMeta: res.HTTPMeta} |
Comment on lines
+122
to
+123
| line := append(typedLine(e.cmd), "--"+e.id, shellWord(e.args[0])) | ||
| x.Next = append(x.Next, "To give it as the ID: `"+strings.Join(line, " ")+"`") |
Comment on lines
+54
to
+56
| // The global flags typed are left out, as a missing-flag hint | ||
| // leaves them out, but for the one fixed: `--jqq .` is `--jq .`. | ||
| if local.Lookup(f.Name) != nil || fixed { |
| if err == nil || !strings.Contains(err.Error(), "error unmarshaling json response body") { | ||
| return false, nil | ||
| } | ||
| kept.Lock() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Stacked on #59. Fixes the CLI-owned issues from round 5 of the usability sweep. Each fix is its own commit, with tests that fail without it. The numbers below are round-5 issue numbers.
This round centres on one rule: every command vf suggests runs as written. A new test checks it (see Hints).
Hints and suggested commands
--actionvf derived from--text, and vf then refused--textwith--action. A flag with fixed choices shows them:<draft|published>, not<value>.transcript get <id> -p Xkeeps-p.--text Hello there, unquoted, becomes--text 'Hello there'.transcrpit search -p X→vf transcript search --project-id X.tool create'stool gethas--type.--user-idorconversation state delete. When vf compiles is unchanged.compiledSourceHash, and the runtime moves the same user's session to the newest compiled build on its next turn (shown for prompt and instruction edits). Only the turn between an edit and a compile is stale. The next PR goes back to "your next turn runs it" and compiles after vf's own edits.TestEverySuggestedCommandRunsmakes every command hit the usual mistakes against a fake API and checks 2,814 suggestions. Each must:TestEveryNextLineRunscovers the 50 Next lines that creates print.Scripting: exit 0 with a wrong result
@fileand-(stdin):function create/update --codeand the patch commands'--old-string/--new-stringprompt --system,function check --cases,--body--value/--default-value--code @lookup_order.jssaved the text "@lookup_order.js". A secret's value never shows in an error.function checkexits 6 when a case didn't match, ran or threw, with a ✗ line naming each case.--file a.md --file b.mdused to add only b.md. The same value twice still runs, and so do flags that collect values (--header).--overwritemeans true;--overwrite --dry-runused to fail "isn't valid JSON".--overwrite true/false/=falsestill work.--stricton the 34 writes that can leave{tokens}unbound: exit 1 after the save. It's opt-in because the change is already saved, and a default failure would make scripts retry it.Knowledge base and environments
environment diffno longer says a bare "No differences.": it says the global prompt isn't compared. JSON gainsnotCompared.document update --waitshows only the outcome; JSON and agent output carry the final status.knowledge-base --helpleads to the document commands, and the home/filter matches upload, add, kb, faq and words in descriptions.sendandknowledge-base querydefault--version-paramto draft, and help says what draft and published mean.--synthesisshows its default and its cost.document list -o tablenames each document's folder, andfolder createsays how to move documents in.--folder-idwaits on the API.Layout
usetext, test runs, pretty values anddocs getbreak between words.function create/updatehelp shows what the code looks like.document listat a terminal is one line per document; piped output is unchanged.Features
widget get-snippetwarns when the widget serves the version made with the project, or a stale publish, withNext: vf environment publish …. At a terminal it prints the snippet bare.agent add-playbook/remove-playbook. The API has no call for one playbook, so these read the agent and send back its list, changed.playbook createsays the new playbook isn't routed yet.transcript get --format-param logs; a write still fails as before.vf environment export [--file], through a hand-written SDK call. The spec marks the endpointx-speakeasy-ignore.Integration notes
function create/updatekept both hooks.Pass them:test leaves out--version-param, which now defaults to draft.For the API team (not in this PR)
environment diffshould cover the global prompt; nothing vf can call reads the published prompt.logs[].createdAt/updatedAtasformat: date, but the API sends date-times.x-speakeasy-ignore.function check's "0 failed" counts only cases that threw.Testing
scripts/vet.sh,go test ./..., the TS suite (181), and go.mod unchanged.